<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <script type="text/javascript">
        function getOptions()
        {
            var x=document.getElementById("mySelect");
            var y="";
            for (i=0;i<x.length;i++)
            {
                y+=x.options[i].text;
                y+="<br />";
            }
            document.write(y);
        }
    </script>
</head>

<body>

<form>
    请选择您喜欢的水果：
    <select id="mySelect">
        <option>苹果</option>
        <option>桃子</option>
        <option>香蕉</option>
        <option>桔子</option>
    </select>
    <br /><br />
    <input type="button" onclick="getOptions()" value="输出所有选项">
</form>

<div align="center">
    <p><a href="../../../index.php#W3SchoolJS" class="fontSize" title="点击进入该目录">目录</a></p>
</div>

</body>
</html>
